import { createSlice } from '@reduxjs/toolkit';

const counterSlice = createSlice({
  name: 'counter',
  initialState: {
    count: 0,
    message: 'custom hook'
  },
  reducers: {
    incrementAction(state) {
      state.count += 1;
    },
    decrementAction(state) {
      state.count -= 1;
    },
    changeMessageAction(state, { payload }) {
      state.message = payload
    }
  }
})

export const { incrementAction, decrementAction, changeMessageAction } =  .actions;
export default counterSlice.reducer;